﻿using Architecture.Domain.Service;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler
{
    public class RoleDeleteCommandHandler : IRequestHandler<RoleDeleteCommand, int>
    {
        private readonly IRoleService roleService;

        public RoleDeleteCommandHandler(IRoleService roleService)
        {
            this.roleService = roleService;
        }

        public async Task<int> Handle(RoleDeleteCommand request, CancellationToken cancellationToken)
        {
            return await roleService.RoleRemove(request.Rid);
        }
    }
}
